package com.xiaoyun.validator;

import com.xiaoyun.annotation.PasswordMatch;
import com.xiaoyun.bo.UserBO;
import com.xiaoyun.bo.center.CenterUserBO;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class PasswordMatchValidatorCenterUserBO implements ConstraintValidator<PasswordMatch, CenterUserBO> {


    @Override
    public void initialize(PasswordMatch constraintAnnotation) {

    }

    @Override
    public boolean isValid(CenterUserBO value, ConstraintValidatorContext context) {
        return value.getPassword().equals(value.getConfirmPassword());
    }

}
